package com.matt.domain.materials;

import com.matt.commons.model.Model;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@Entity
@Table(name = "materiel_records")
@EqualsAndHashCode(callSuper = true)
public class MaterielRecords extends Model {
  @Column(name = "aid", columnDefinition = " varchar(32) COMMENT '对应园区id' ")
  private String aid;

  /**
   * 日期
   */
  @Column(name = "date", columnDefinition = " datetime DEFAULT NOW() COMMENT '日期' ")
  private Date date;

  /**
   * 备注
   */
  @Column(name = "remark", columnDefinition = " varchar(140) COMMENT '备注' ")
  private String remark;

  /**
   * 员工
   */
  @Column(name = "operatorId", columnDefinition = " varchar(32) COMMENT '员工id' ")
  private String operatorId;

  /**
   * 操作人姓名
   */
  @Column(name = "operatorName", nullable = false, columnDefinition = " varchar(50) COMMENT '操作人姓名' ")
  private String operatorName;

  /**
   * 关联员工id
   */
  @Column(name = "linkId", columnDefinition = " varchar(32) COMMENT '关联员工id' ")
  private String linkId;

  /**
   * 关联员工名称
   */
  @Column(name = "linkName", nullable = false, columnDefinition = " varchar(50) COMMENT '关联员工姓名' ")
  private String linkName;

  /**
   * 操作， 0 常规， 1 借出   2 归还
   */
  @Column(name = "actType", columnDefinition = " int COMMENT '操作类型' ")
  private Integer actType;

  /**
   * 状态，  1，open    2，close
   */
  @Column(name = "status", columnDefinition = " int COMMENT '状态' ")
  private Integer status;

  /**
   * 创建时间
   */
  @Column(name = "created", nullable = false)
  private Timestamp created;

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "materielRecords")
  private List<MaterielRecordItems> items;
  
}